<?
	include('includes/dvt_config.php');
	$act = $_GET['act'];
	$id = intval($_GET['id']);
	$url = $_SESSION['url'];
	$u_id = intval($_GET['u_id']);
	
	function del_comment($id){
		global $db,$prefix;
		if(isset($id)){
				$rs = $db->query("DELETE FROM ".$prefix."sanpham_comment WHERE cm_id = '".$id."'");
		}
	}
	
	function del_sanpham($id){
		global $db,$prefix;
		if(isset($id)){
				$rs = $db->query("DELETE FROM ".$prefix."sanpham WHERE t_id = '".$id."'");
		}
	}
	
	
	function del_news_comment($id){
		global $db,$prefix;
		if(isset($id)){
				$rs = $db->query("DELETE FROM ".$prefix."tintuc_comment WHERE cm_id = '".$id."'");
		}
	}
	
	function del_tinraovat($id){
		global $db,$prefix;
		if(isset($id)){
				$rs = $db->query("DELETE FROM ".$prefix."raovat WHERE rv_id = '".$id."'");
		}
	}
	
	function del_tintuyendung($id){
		global $db,$prefix;
		if(isset($id)){
				$rs = $db->query("DELETE FROM ".$prefix."tuyendung WHERE td_id = '".$id."'");
		}
	}
	
	switch($act){
		case 'del_comment':
			if($_SESSION['uid'] == $u_id){
				del_comment($id);
			}
			//echo $url;
			header("Location: ".$url."");
		break;
		case 'del_tinraovat':
			if($_SESSION['uid'] == $u_id){
				del_tinraovat($id);
			}
			header("Location: index.php?mod=raovat");
		break;
		case 'del_tintuyendung':
			if($_SESSION['uid'] == $u_id){
				del_tintuyendung($id);
			}
			header("Location: index.php?mod=tuyendung");
		break;
		case 'del_sanpham':
			if($_SESSION['uid'] == $u_id){
				del_sanpham($id);
			}
			//echo $url;
			header("Location: ".$url."");
		break;
		case 'del_news_comment':
			if($_SESSION['uid'] == $u_id){
				del_news_comment($id);
			}
			//echo $url;
			header("Location: ".$url."");
		break;
		default:
			reHome($urlHome);
		break;
	}
?>